const deepCopy = (data: { [x: string]: any }) => {
  let newData :any= null
  if (Object.prototype.toString.call(data) === '[object Object]') {
    newData = {}
  } else if (Object.prototype.toString.call(data) === '[object Array]') {
    newData = []
  } else {
    return data
  }
  for (const key in data) {
    if (typeof data[key] === 'object') {
      newData[key] = deepCopy(data[key])
    } else {
      newData[key] = data[key]
    }
  }
  return newData
}
export default deepCopy
